A conventional method of detecting a position of a turret of an NC lathe and so on when an indexing of the turret is effected is as follows. That is, (1) a method of detecting a position of the turret is effected in which different code signals are generated at every stop angle position by using a plurality of dog members attached on a code disc fixed to the turret and a plurality of limit switches which are operated by these dog members, and (2) a method of detecting a position of the turret is effected by counting the number of pulses, each of which is generated at every stop position of the turret due to the operation of a single limit switch operated by dog members, each of which is attached on a code disc of the turret at every stop position.
However, the methods of detecting the positions by the above-mentioned prior art devices have the following disadvantages. The method (1) uses, besides a plurality of limit switches used for generating different code signals at every stop position of the turret, a limit switch for a parity bit, which is used for detecting an error of the code signal which may be caused by a defective limit switch, and a limit switch for generating strobe signals, which prevent erroneous detection of the code signal caused by the spread of the operating times of the limit switches disposed on each of the stop positions of the turret. Therefore, the method (1) uses a large number of limit switches, so that the position detecting mechanism becomes complex and expensive and it is impossible to use such a method in a machine tool in which a large number of limit switches cannot be arranged due to the limitations of the structure or the space of the machine tool. With regard to the method (2), this method uses a single limit switch, so that the structure of the position detecting mechanism becomes simple and the limitation of usage due to the limitation of space is small. However, in the method (2), there is a possibility of erroneous positioning caused by an error in counting the pulses generated by the single limit switch due to a defective contact of the limit switch.
Concerning the problems of the above-mentioned conventional devices, the present invention uses the idea of detecting an error of a code signal generated at every stop position of the turret by counting the strobe signals, in a control device for indexing a stepwisely rotatable member. It is an object of the present invention to make it possible to effect precise and reliable indexing by using a relatively small number of limit switches and without using a limit switch for a parity bit.